package com.dmj.sqldsl.util;

import static com.dmj.sqldsl.utils.ReflectionUtils.invokeMethod;

import java.io.Serializable;
import java.lang.invoke.SerializedLambda;

@FunctionalInterface
public interface GetMethodLambda<T, R> extends Serializable {

  R apply(T t);

  default String getFieldName() {
    SerializedLambda lambda = invokeMethod("writeReplace", this);
    return lambda.getImplMethodName().substring(3);
  }
}